<template>
  <div>
    <h1>发布者</h1>
    <input v-model="msg"></input>
    <button @click="handleClick">发布</button>
  </div>
</template>

<script>
import Bus from '@/utils/Bus'

export default {
  name: "Publisher",
  data() {
    return {
      msg: ''
    }
  },
  methods: {
    handleClick() {
      Bus.emit('getMsg', this.msg)
    },
    getBus() {
      // 像父级传递Bus实例
      return Bus
    }
  },
  mounted() {
    this.$bus.emit('getMsgOnce', 1, 2)
  }
}
</script>

<style scoped>

</style>
